package com.gxa.web_admin.controller.operationscontroller;


import com.gxa.common.R;
import com.gxa.modules.service.operationsservice.ClientService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Client")
@Api(value = "客户管理",tags = "客户信息接口API")
public class ClientController {

    @Autowired(required = false)
    public R r;
    @Autowired(required = false)
    ClientService clientservice;

    @ApiResponses({
            @ApiResponse(code = 200, message = "请求成功"),
            @ApiResponse(code = 400, message = "参数格式不对"),
            @ApiResponse(code = 404, message = "找不到页面"),
            @ApiResponse(code = 500, message = "后台服务错误")
    })
    @RequestMapping(value = "/selectAllClientForPage", method = RequestMethod.GET)
    @ApiOperation(value = "客户信息查询接口", notes = "提供当前页码数与每页显示条数", httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页码数", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页显示条数", required = true, dataType = "int", paramType = "query")
    })
    public R selectAllClientForPage(int page, int size) {

        return clientservice.selectAllClientForPage(page, size);
    }
    @RequestMapping(value = "/selectAllClient", method = RequestMethod.GET)
    @ApiOperation(value = "根据多种条件查询访客信息接口", notes = "条件查询访客信息", httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page", value = "当前页码数", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "size", value = "每页显示条数", required = true, dataType = "int", paramType = "query"),
            @ApiImplicitParam(name = "clientName", value = "客户名称", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "visitType", value = "意向等级", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "clientLevel", value = "客户等级", required = false, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "followUpStatus", value = "跟进状态", required = false, dataType = "String", paramType = "query")
    })

    public R selectAllClient(int page, int size, String clientName, String intentionLevel, String clientLevel,
                             String followUpStatus) {

        return  clientservice.selectAllClient(page,  size,  clientName,  intentionLevel,  clientLevel,
                followUpStatus);

    }
}
